import request from '@/utils/request'

export const add = function(params) {
  return request({
    url: '/api/vm-service/vm/search',
    method: 'GET',
    params
  })
}

// 商品销售量
export const salesVolume = function(params) {
  return request({
    url: '/api/order-service/report/skuCollect/' + params.innerCode	+ '/' + params.start + '/' + params.end,
    method: 'GET',
    params
  })
}
// 维修次数
export const weiXiuCiShu = function(params) {
  return request({
    url: '/api/task-service/task/repairCount/' + params.innerCode	+ '/' + params.start + '/' + params.end,
    method: 'GET',
    params
  })
}
// 补货次数
export const xiaoShouLiangya = function(params) {
  return request({
    url: '/api/task-service/task/supplyCount/' + params.innerCode	+ '/' + params.start + '/' + params.end,
    method: 'GET',
    params
  })
}

// 售货机类型
export const shouHuoJiXing = function() {
  return request({
    url: '/api/vm-service/vmType/:typeId',
    method: 'GET'
  })
}

// 售货列表
export const shouHouLieBiao = function(params) {
  return request({
    url: '/api/vm-service/vmType/search',
    method: 'GET',
    params
  })
}

// 销售机类型删除
export const xiaoShouJiShanCu = function(typeId) {
  console.log(typeId)
  return request({
    url: '/api/vm-service/vmType/' + typeId,
    method: 'DELETE'
  })
}

// 点位列表
export const dianWeiLieBiao = function(params) {
  return request({
    url: '/api/vm-service/node/search',
    method: 'GET',
    params
  })
}

// 修改售货机点位
export const dianWeiXiuGai = function(data) {
  return request({
    url: '/api/vm-service/vm/' + data.id + '/' + data.nodeId,
    method: 'PUT',
    data
  })
}

// 新增售货机
export const xingZengShouHouJi = function(data) {
  return request({
    url: '/api/vm-service/vm',
    method: 'POST',
    data
  })
}

export const shouHouJi = function(params) {
  return request({
    url: '/api/vm-service/policy/vmPolicy/' + params.innerCode,
    method: 'GET'
  })
}

// 策略列表
export const ceLueBiaoYaLe = function() {
  return request({
    url: '/api/vm-service/policy',
    method: 'GET'
  })
}

// 修改策略
export const xiuGaiCeLue = function(data) {
  return request({
    url: '/api/vm-service/policy/' + data.policyId,
    method: 'PUT',
    data
  })
}
